﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IniParser;

namespace Installer.IniHandler
{
    class IniOptions
    {
        private FileIniDataParser _parser;
        private IniData _IniData;

        private static IniOptions _IniOptions = null;
        public static IniOptions Instance
        {
            get
            {
                if (_IniOptions == null)
                {
                    _IniOptions = new IniOptions();
                }
                return _IniOptions;

            }
        }


        public IniOptions()
        {

            _parser = new FileIniDataParser();
            _IniData = new IniData();
        }


        public void SetIniFile(string FileName)
        {
            _IniData = _parser.LoadFile(FileName);
        }

        public SectionDataCollection GetSection()
        {
            return _IniData.Sections;
        }

        public string GetSectionKeyData(string Section, string Key)
        {
            return _IniData.Sections[Section][Key];
        }
    }
}

